/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kmcsoft.goldshop.model.exchange;

import com.kmcsoft.emaster.entity.TrackableEntity;
import com.kmcsoft.goldshop.model.master.ProductGold;
import com.kmcsoft.goldshop.model.master.Unit;
import javax.jdo.annotations.Column;
import javax.jdo.annotations.FetchGroup;
import javax.jdo.annotations.FetchGroups;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;

/**
 *
 * @author kmcsoft02
 */
@PersistenceCapable(detachable = "true", table = "EXC_GoldExchangeDetail")
@FetchGroups(value = {
    @FetchGroup(name = "detach_GoldExchangeDetail_All", members = {
        @Persistent(name = "productGold"),
        @Persistent(name = "unit")}),
    @FetchGroup(name = "detach_GoldExchangeDetail_GoldType", members = {
        @Persistent(name = "productGold")}),
    @FetchGroup(name = "detach_GoldExchangeDetail_Unit", members = {
        @Persistent(name = "unit")})
})
public class GoldExchangeDetail extends TrackableEntity {

    @Persistent
    @Column(defaultValue = "0")
    private double sellingPrice;
    @Persistent
    @Column(defaultValue = "0")
    private double buyingPrice;
    @Persistent
    private ProductGold productGold;
    @Persistent
    private Unit unit;

    public GoldExchangeDetail(ProductGold productGold) {
        this.productGold = productGold;
        this.buyingPrice = productGold.getBuyingPrice();
        this.sellingPrice = productGold.getSellingPrice();
        this.unit=productGold.getUnit();
    }

    public double getBuyingPrice() {
        return buyingPrice;
    }

    public void setBuyingPrice(double buyingPrice) {
        this.buyingPrice = buyingPrice;
    }

    public ProductGold getProductGold() {
        return productGold;
    }

    public void setProductGold(ProductGold productGold) {
        this.productGold = productGold;
    }


    public double getSellingPrice() {
        return sellingPrice;
    }

    public void setSellingPrice(double sellingPrice) {
        this.sellingPrice = sellingPrice;
    }

    public Unit getUnit() {
        return unit;
    }

    public void setUnit(Unit unit) {
        this.unit = unit;
    }
    
}
